var express = require('express');
var router = express.Router();


let db = {}

function auto(req, res, next) {
  console.log(req.url, 'url')
  console.log(req.query, 'query')
  console.log(db, 'db')
  next()
}

/* GET home page. */
router.get('/', function (req, res, next) {
  res.render('index', { title: 'Express' });
});

router.get('/login', async (req, res, next) => {
  db = req.query;
  res.send({
    db
  })
})

router.get('/list', auto, async (req, res, next) => {
  res.send({
    db
  })
})

module.exports = router;
